clear all;clc;close all;
D=10;
Xmin=-100;
Xmax=100;
pop_size=50;
iter_max=3000;
N = 50;
a = rand(10,1);
a = a / sum(a);
i = RouletteWheel(a, N);
b = zeros(10,1);
for n = 1 : 10
    b(n,1) = sum(i'==n);
end
b=b/N;
% date = fix(clock);
% str_date = num2str(date(1));
% for i = 2:6
%     str_date = [str_date '_' num2str(date(i))];
% end
% 
% func_num = 1;
% j= 1;
% inipos_filename = cd;
% inipos_filename = [inipos_filename '\IniPos\IniPos_DSMMFR_' num2str(D) '_' num2str(pop_size) '_' num2str(Xmin) '_' num2str(Xmax) '_' num2str(func_num) '_' num2str(j) '.dat'];
% if(exist(inipos_filename) ~= 0)
%     pos = csvread(inipos_filename);
%     a = 1
% else
%     pos = InitializePopulation(D,pop_size,Xmin,Xmax);  
%     csvwrite(inipos_filename, pos);
%     a = 0
% end
% ps = 50;
% NumSC = 4; % For Social Class
% size_each_level = repmat(floor(ps/NumSC),1,NumSC);
% size_each_level(NumSC) = ps - (size_each_level(1)*(NumSC-1));
% lb_level(1,1) = 1;
% ub_level(1,1) = size_each_level(1);
% 
% pos = (1:ps)';
% leader = [2;33;16;12];
% leader_id = [2;33;16;12];
% temp_pos = zeros(ps,1);
% for l = 2 : NumSC
%     lb_level(l,1) = sum(size_each_level(1,1:l-1))+1;
%     ub_level(l,1) = sum(size_each_level(1,1:l));
% end
% 
% for l = 1 : NumSC
%     leader(l,:) = pos(leader_id(l,1),:);  
%     temp_pos(ub_level(l,1),:) = leader(l,:);
% end
% count = 1;
% for n = 1 : ps        
%     if(sum(n==ub_level) == 0)            
%         while(sum(count==leader_id))
%             count = count + 1;
%         end
%         temp_pos(n,:) = pos(count,:);
%         count = count + 1;
%     end
% end
mi = 3000;
a = zeros(1,mi);
for i = 1 : mi
    a(1,i) = 0.24 * (exp(-i/3000))^6 + 0.01;
end
plot(a);

